{extend name="public/home"/}
{block name='css'}
  <link rel="stylesheet" href="/static/css/withdraw.css">
{/block}
{block name="content"}
 <div class='case'>
            <div class='roof'>
                <div class='top'>
                    <span>欢迎您{$record.contact}，当前您正在操作</span>
                    <span class='red'>帐户出金</span>
                </div>
                <div>
                    <span>你的账户账户信息：</span>
                    <span class='eng'>{$record.username}</span>
                    <span class='chn'>{$record.contact}</span>
                </div>
                <div>
                    <span>你的联络方式：</span>
                    <span class='phone'>{$record.mobile}</span>
                    <span class='email'>{$record.email}</span>
                </div>
                <div>
                    <span>依据系统统计：截止至当前，您共有</span>
                    <span class='red'>{$times}</span>
                    <span>次成功出金记录，涉及金额</span>
                    <span class="red">CNY:{$money}</span>
                </div>
            </div>
            <form action="" method="post">
                <input type="hidden" name="catid" value = "2"/>
                <input type="hidden" name="lang" value="cn"/>
                <input type="hidden" name="username" value="{$record.username}"/>
                <input type="hidden" name="contact" value="{$record.contact}"/>
                <input type="hidden" name="email" value="{$record.email}"/>
                <input type="hidden" name="mobile" value="{$record.mobile}"/>
                <input type="hidden" name="audit" value="2"/>
                <div class='withdraw'>
                    <p><span class='red'>*</span>出金金额&收款信息　Payment rates&billing information</p>
                    <input type="hidden" name='catid' value='2'>
                    <div>
                        <label>出金金额：</label>
                        <input type="text" name='amount_cn' id='amount_cn' required>
                    </div>
                    <div>
                        <label for='bank'>银行名称：</label>
                        <input type="text" name='bank' id='bank' value = "{$record.bank}" required>
                    </div>
                    <div>
                        <label for='banksub'>支行名称：</label>
                        <input type="text" id='banksub' name='banksub' value = "{$record.banksub}" required>
                    </div>
                    <div>
                        <label for='bankcode'>银行代码：</label>
                        <input type="text" id='bankcode' name='bankcode' value = "{$record.bankcode}">
                    </div>
                    <div>
                        <label for='bankaddress'>银行地址：</label>
                        <input type="text"  id='bankaddress' name='bankaddress'value = "{$record.bankaddress}" required>
                    </div>
                    <div>
                        <label for='bankname'>账户名：</label>
                        <input type="text" id='bankname' name='bankname' value = "{$record.bankname}" required>
                    </div>
                    <div>
                        <label for='bankcard'>卡号：</label>
                        <input type="text" id='bankcard' name='bankcard' value = "{$record.bankcard}" required>
                    </div>
                </div>    
            </form>
            
            <input type="button" value="提交出金信息">
        </div>
{/block}

{block name='script'}
  <script>
      $(function(){
        $('input[type="button"]').on('click', function(){
          var data = $('form').serialize();
          $.ajax({
            url:'{:url("")}',
            data:data,
            type:'post',
            dataType:'json',
            beforeSend:function(){
                if($('#bank').val() =='' || $('#banksub').val() ==''|| $('#bankaddress').val() ==''|| $('#bankname').val() ==''|| $('#bankcard').val() ==''|| $('#amount_cn').val() =='') {
                    alert('请填写完整');
                    return false;
                }
            },
            success:function(info){
              // console.log(info);
              if(info.code == 0) {
                alert('提交成功');
                window.location.reload();
              }
            }
          })
        })
    });
  </script>
{/block}
